package com.example.service.impl;

import com.example.dao.OrderdetailMapper;
import com.example.entity.Orderdetail;
import com.example.service.OrderdetailService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
public class OrderdetailServiceImpl implements OrderdetailService {
    @Resource
    OrderdetailMapper orderdetailMapper;

    @Override
    public PageInfo<Orderdetail> queryAll(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        ArrayList<Orderdetail> orderdetailList = orderdetailMapper.queryAll();
        PageInfo<Orderdetail> pageInfo = new PageInfo<>(orderdetailList);
        return pageInfo;
    }

    @Override
    public int deleteById(Integer id) {
        return orderdetailMapper.deleteById(id);
    }

    @Override
    public Orderdetail findById(Integer id) {
        return orderdetailMapper.findById(id);
    }

    @Override
    public int update(Orderdetail orderdetail) {
        return orderdetailMapper.update(orderdetail);
    }

    @Override
    public int insert(Orderdetail orderdetail) {
        return orderdetailMapper.insert(orderdetail);
    }

    @Override
    public Orderdetail findByOid(Integer id) {
        return orderdetailMapper.findByOid(id);
    };
}
